import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;


//二、3、
public class _2_3 {
    public static void main(String[] args) {
        Scanner in =new Scanner(System.in);
        HashSet<Teacher> teachers=new HashSet<>();
        int number;
        String name;
        for (int i = 0; i < 20; i++) {
            System.out.println("请输入第"+i+1+"位教师的工号：");
            number=in.nextInt();
            System.out.println("请输入第"+i+1+"位教师的姓名：");
            name=in.next();
            teachers.add(new Teacher(number,name));

            System.out.println("请输入要查询的教师工号：");
            number=in.nextInt();
            Iterator<Teacher> iterator = teachers.iterator();
            boolean flag=false;
            while (iterator.hasNext()){
                Teacher temp=iterator.next();
                if(temp.getNumber()==number){
                    System.out.println("教师的姓名是:"+temp.getName());
                    flag=true;
                    break;
                }
            }

            if(!flag){
                System.out.println("无该教师！");
            }
            in.close();
        }
    }
}

class Teacher{
    private int number;//工号
    private String name;//姓名

    public Teacher(int number, String name) {
        this.number = number;
        this.name = name;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
